
from fastapi import APIRouter,File,UploadFile
import uuid
router = APIRouter()

@router.post("/upload")
def upload(file: UploadFile = File(...)):

    file.filename = str(uuid.uuid4()) + file.filename
    with open(f"static/{file.filename}", "wb") as f:
        f.write(file.file.read())
        
    return {"code":200,"data":"http://localhost:8000/static/"+file.filename,"message":"success"}